from abc import ABC, abstractmethod

class InputItem:
    def __init__(self, label, input_name, input_type, default_value, placeholder_text, options: list[str], required=False):
        self.label = label  # 显示名称（可以是中文）
        self.input_name = input_name  # 变量名（与代码中的变量名一致）
        # file\folder\text\number\select
        self.input_type = input_type
        self.default_value = default_value
        self.placeholder_text = placeholder_text
        self.options = options
        self.required = required

class OutputItem:
    def __init__(self, name, value):
        self.name = name
        self.value = value

class Domain(ABC):

    @abstractmethod
    def get_input_items(self) -> list[InputItem]:
        pass

    def set_input_values(self, input_values: dict):
        """将用户输入绑定到类属性"""
        for input_item in self.get_input_items():
            if hasattr(self, input_item.input_name):
                setattr(self, input_item.input_name, input_values.get(input_item.input_name))

    @abstractmethod
    def execute(self) -> str:
        pass